//
//  RightButtonVC.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/4/17.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#import "RightButtonVC.h"
#import "DouDetailsCell.h"
#import "TodoHttpManager.h"
@interface RightButtonVC ()<UITableViewDataSource,UITableViewDelegate>
{
    NSMutableArray *_oneTiArr;
    NSString *str;
    NSString *str1;
    NSString *str2;
    NSString *str3;
    NSString *str4;
    
}
@property(nonatomic,strong)UITableView *tabView;
@property(nonatomic,strong)NSMutableDictionary *dingDic;
@property(nonatomic,strong)NSMutableArray *biaoArr;
@end

@implementation RightButtonVC

-(void)viewWillAppear:(BOOL)animated
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didTDCeoMeBusPeiDingJ:) name:TDCeoMeBusPeiDingJ object:nil];
    
    [_manager userCeoBUsPeiDingJSMWithID:_shenID];
}
-(void)didTDCeoMeBusPeiDingJ:(NSNotification *)notifi
{
    if (notifi.object != 0)
    {
        _dingDic = [notifi.object objectForKey:@"data"];
        
        str = [_dingDic objectForKey:@"count"];
        str1 = [_dingDic objectForKey:@"area"];
        str2 = [_dingDic objectForKey:@"zongjia"];
        str3 =  [_dingDic objectForKey:@"junjia"];
        
      //  str4 = [_dingDic objectForKey:@"djsm"];
     
 
        
        
        _biaoArr = [[NSMutableArray alloc] initWithObjects:str,str1,str2,str3, nil];
        
        
        
        
        
        
        [_tabView reloadData];
        
    }
}
-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:TDCeoMeBusPeiDingJ object:nil];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"定价说明";
    self.view.backgroundColor = BgColor;
    
    _dingDic = [NSMutableDictionary dictionary];
    _manager = [TodoHttpManager sharedManager];
    _oneTiArr = [NSMutableArray arrayWithObjects:@"商业间数:",@"商业面积:",@"表价总价:",@"标价均价:", nil];
    _tabView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, B_WIDTH, B_HEIGHT) style:UITableViewStylePlain];
    _tabView.delegate = self;
    _tabView.dataSource = self;
    _tabView.backgroundColor = BgColor;
    _tabView.rowHeight = 44;
    _tabView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    [self.view addSubview:_tabView];
    


}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    
    
    return _oneTiArr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIndent = @"CellB";

    
        DouDetailsCell *cell = [tableView cellForRowAtIndexPath:indexPath];
        if (cell ==nil)
        {
            cell = [[DouDetailsCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndent];
            
            
        }

    if ([cell isKindOfClass:[DouDetailsCell class]])
    {
        if (_biaoArr.count !=0)
        {
            
            NSString *str0 = (NSString *)_biaoArr[indexPath.row];
            cell.secondLab.text = [NSString stringWithFormat:@"%@",str0];
            
            
        }
     
        
    }
    
        cell.firstLab.text = _oneTiArr[indexPath.row];
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//取消点击
        return cell;
        
    
    
}













- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
